(define (fold-right op initial sequence)
    (if (null? sequence)
        initial
        (op 
            (car sequence)
            (fold-right op initial (cdr sequence))
        )
    )
)
(define (flod-left op initial sequence)
    (define (iter result rest)
        (if (null? rest)
            result
            (iter 
                (op result (car rest ))
                rest
            )    
        )
    )
    (iter initial sequence)
)

(define (reverse1 s)
    (fold-right 
        (lambda (x y) 
            (append y (list x))
        )
        `()
        s
    )
)

(define (reverse2 s)
    (fold-left 
        (lambda (x y)            
            (append (list y) x)
        )
        `()
        s
    )
)

(define seqs (list 1 2 3 4))

(display (reverse1 seqs))
(newline)
(display (reverse2 seqs))
(exit)
